<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    
  <title>The source code</title>
    <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
    <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
</head>
<body  onload="prettyPrint();">
    <pre class="prettyprint lang-js"><div id="cls-Ext.util.TimeLine"></div>/**
 * @private
 * @class Ext.util.TimeLine
 * @extends Ext.util.Observable
 * To be implemented POST Beta.
 */
Ext.util.Timeline = Ext.extend(Ext.util.Observable, {
    constructor : function(anims) {
        Ext.util.Timeline.superclass.constructor.call(this);

        if (anims) {
            this.add(anims);
        }
    },

    play : function() {
        this.playing = true;
        this.queue = this.anims.slice();
        this.next();
    },

    next : function() {
        if (this.queue.length) {
            var anim = this.queue.shift();
            if (Ext.isObject(anim)) {
                anim = new Ext.Anim(anim);
                anim.run(anim.target, {
                    after: function() {
                        this.next();
                    },
                    scope: this
                });
            }
            else if (Ext.isArray(anim)) {
                var anims = anim,
                    ln = anims.length,
                    i, longest = anims[0];

                for (i = 0; i < ln; i++) {
                    anim = anims[i];
                    anim = new Ext.Anim(anim);
                    if ((anim.duration + anim.delay) >= (longest.duration + anim.delay)) {
                        longest = anim;
                    }
                    anims[i] = anim;
                }

                for (i = 0; i < ln; i++) {
                    anim = anims[i];
                    if (longest === anim) {
                        anim.after = function() {
                            this.next();
                        };
                        anim.scope = this;
                    }
                    anim.run(anim.target);
                }
            }
        }
    },

    pause : function() {
        // still needs to be implemented
    },

    reset : function() {
        // still needs to be implemented
    },

    clear : function() {
        if (this.playing) {
            // pause and remove anims
        }
        this.anims = [];
    },

    stop : function() {
        if (this.playing) {
            this.pause();
            // put all the animations to their original start location?
        }
    },

    add : function(anims) {
        this.anims = this.anims || [];
        if (Ext.isArray(anims)) {
            this.anims = this.anims.concat(anims);
        }
        else {
            this.anims.push(anims);
        }
    }
});</pre>    
</body>
</html>